<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Freetype OpenGL: Shader</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="style.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="content"><!-- do not remove this div! -->

<div id="top"><!-- do not remove this div! -->

  
  <div id="titlearea">
    
    <div id="projectname">Freetype OpenGL</div>
    
    
    <div id="projectbrief">A high quality OpenGL text rendering engine for C</div>
    
  </div>
  

<!--

<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Freetype OpenGL
   &#160;<span id="projectnumber">0.1</span>
   </div>
   <div id="projectbrief">A high quality OpenGL text rendering engine for C</div>
  </td>
  
  
  
   
  
 </tr>
 </tbody>
</table>
</div>
-->


<!-- Generated by Doxygen 1.8.0 -->
<script type="text/javascript" src="dynsections.js"></script>
</div>
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Shader</div>  </div>
</div><!--header-->
<div class="contents">
<hr/><a name="details" id="details"></a><h2>Synopsis</h2>
<p>Simple functions for loading/building a shader from sources. </p>
<p><b>Example Usage</b>: </p>
<div class="fragment"><pre class="fragment"><span class="preprocessor"> #include &quot;<a class="code" href="shader_8h.html">shader.h</a>&quot;</span>

 <span class="keywordtype">int</span> main( <span class="keywordtype">int</span> arrgc, <span class="keywordtype">char</span> *argv[] )
 {
     GLuint shader = <a class="code" href="group__shader.html#ga2b7a0078428da8b7fd08b17b498de7f3" title="Load a vertex and fragment shader sources and build program.">shader_load</a>(<span class="stringliteral">&quot;shader.vert&quot;</span>, <span class="stringliteral">&quot;shader.frag&quot;</span>);

     <span class="keywordflow">return</span> 0;
 }
</pre></div> <table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gafd3634ef9834731b71aa9036dc05acdd"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__shader.html#gafd3634ef9834731b71aa9036dc05acdd">shader_read</a> (const char *filename)</td></tr>
<tr class="memdesc:gafd3634ef9834731b71aa9036dc05acdd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read a fragment or vertex shader from a file.  <a href="#gafd3634ef9834731b71aa9036dc05acdd"></a><br/></td></tr>
<tr class="memitem:gab9073cdf599b2fd64f1214eec117b56f"><td class="memItemLeft" align="right" valign="top">GLuint&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__shader.html#gab9073cdf599b2fd64f1214eec117b56f">shader_compile</a> (const char *source, const GLenum type)</td></tr>
<tr class="memdesc:gab9073cdf599b2fd64f1214eec117b56f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compile a shader from a text buffer.  <a href="#gab9073cdf599b2fd64f1214eec117b56f"></a><br/></td></tr>
<tr class="memitem:ga2b7a0078428da8b7fd08b17b498de7f3"><td class="memItemLeft" align="right" valign="top">GLuint&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__shader.html#ga2b7a0078428da8b7fd08b17b498de7f3">shader_load</a> (const char *vert_filename, const char *frag_filename)</td></tr>
<tr class="memdesc:ga2b7a0078428da8b7fd08b17b498de7f3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Load a vertex and fragment shader sources and build program.  <a href="#ga2b7a0078428da8b7fd08b17b498de7f3"></a><br/></td></tr>
</table>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="gab9073cdf599b2fd64f1214eec117b56f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">GLuint <a class="el" href="group__shader.html#gab9073cdf599b2fd64f1214eec117b56f">shader_compile</a> </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>source</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const GLenum&#160;</td>
          <td class="paramname"><em>type</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Compile a shader from a text buffer. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">source</td><td>code of the shader </td></tr>
    <tr><td class="paramname">type</td><td>type of the shader</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>a handle on the compiled program </dd></dl>

</div>
</div>
<a class="anchor" id="ga2b7a0078428da8b7fd08b17b498de7f3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">GLuint <a class="el" href="group__shader.html#ga2b7a0078428da8b7fd08b17b498de7f3">shader_load</a> </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>vert_filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>frag_filename</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Load a vertex and fragment shader sources and build program. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">vert_filename</td><td>vertex shader filename </td></tr>
    <tr><td class="paramname">frag_filename</td><td>fragment shader filename</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>a handle on the built program </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="demo-atb-agg_8c-example.html#a44">demo-atb-agg.c</a>, and <a class="el" href="demo-distance-field_8c-example.html#a11">demo-distance-field.c</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="gafd3634ef9834731b71aa9036dc05acdd"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char* <a class="el" href="group__shader.html#gafd3634ef9834731b71aa9036dc05acdd">shader_read</a> </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>filename</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Read a fragment or vertex shader from a file. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">filename</td><td>file to read shader from </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>a newly-allocated text buffer containing code. This buffer must be freed after usage. </dd></dl>

</div>
</div>
</div><!-- contents -->
</div>
</body>
</html>
